#include "except.h"
#include "../PRINT/my_printf.h"
#include "../UART/uart.h"
#include "../EXTI/exti.h"
#include "../VIC/vic_reg.h"
#include "../PUBLIC/test.h"

void except_und(u32 addr){
    printf("[%x] Triggered undefined exceptions!\r\n", addr);
}

void except_swi(u32 addr){
    u32 val;
    val = *(u32 *)addr & 0xFFFFFF;
    printf("[%x] Triggered SWI exceptions 0x%x\r\n", addr, val);
}

void except_pabort(u32 addr){
    printf("[%x] Triggered PAbort exceptions\r\n", addr);
}

void except_dabort(u32 addr){
    printf("[%x] Triggered DAbort exceptions\r\n", addr);
}

void except_irq(u32 addr){
    // printf("[%x] Triggered IRQ exceptions!\r\n", addr);
    if(VICIRQSTATUS_CH0){   // 具体的中断函数
        ((void (*)(void))VICADDRESS_CH0)();
    }else if(VICIRQSTATUS_CH1){
        ((void (*)(void))VICADDRESS_CH1)();
    }
}

